﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class ajax_backinfo : System.Web.UI.Page
{
    public string div = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (this.Session["username"] == null || this.Session["username"].ToString() == "")
            {
                this.Response.Redirect("../main.aspx");
            }
            string sid = this.Session["userid"].ToString();
            string sql = "select gfcode from t_user_access where userid='" + sid + "' union select funccode from t_user_grantfunc where grpcode = (select grpcode from t_user1 where userid='" + sid + "') ";
            //string sql = "select gfcode from t_user_access where userid='admin' union select funccode from t_user_grantfunc where grpcode = (select grpcode from t_user1 where userid='admin') ";
            string str = System.Configuration.ConfigurationSettings.AppSettings["ConnStr"];
            using (SqlConnection con = new SqlConnection(str))
            {
                SqlCommand cmd = new SqlCommand(sql, con);
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                //<div>&gt;&gt;&nbsp;<span style="font-size:18pt;">EasyCRM后台管理面块</span></div><br />
                //<div style="height: 35px">&nbsp;1.<a href="../admin/user_index.aspx" target="_blank">用户管理</a></div>
                //<div style="height: 35px">&nbsp;2.<a href="../system/send_emailgroup.aspx" target="_blank">群组发送邮件</a></div>
                //<div style="height: 35px">&nbsp;3.<a href="../system/chkapply.aspx" target="_blank">审核赠刊申请</a></div>
                //<div style="height: 35px">&nbsp;4.<a href="../admin/user_index.aspx" target="_blank">用户管理</a></div>xxxxxxxxx
                //div += "<div>&gt;&gt;&nbsp;<span style='font-size:18pt;'>EasyCRM后台管理面块</span></div><br />";
                while (reader.Read())
                {
                    string s = reader[0].ToString();

                    switch(s)
                    {
                        case "A01":
                            div += "<div style='height: 35px'>&nbsp;1.<a href='admin/user_index.aspx' target='_blank'>用户管理</a></div>";
                            break;
                        case "A03":
                            div += "<div style='height: 35px'>&nbsp;2.<a href='system/send_emailgroup.aspx' target='_blank'>群组发送邮件</a></div>";
                            break;
                        case "A04":
                            div += "<div style='height: 35px'>&nbsp;3.<a href='system/chkapply.aspx' target='_blank'>审核赠刊申请</a></div>";
                            break;
                    }
                }
                reader.Close();
            }
        }
    }
}
